class ResponseBody {

  data = {};
  state = 'ok';
  msg = '';

  constructor(data, state, msg = '') {
    this.data = data;
    this.state = state;
    this.msg = msg;
  }

  toJson() {
    return {
      status: this.state,
      msg: this.msg,
      data: this.data
    };
  }
}
export class ErrResponse extends ResponseBody {
  constructor(data, msg = '') {
    super(data, 'err', msg);
  }
}
export class SuccessResponse extends ResponseBody {
  constructor(data, msg = '') {
    super(data, 'ok', msg);
  }
}
